package com.cykj.admin.controller;

import com.cykj.admin.annotation.MyLog;
import com.cykj.admin.service.IUserService;
import com.cykj.admin.vo.UserVO;
import com.cykj.common.dto.ResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject:@BelonqsPackage:com.cykj.admin.controller
 * @Author:jiangna
 * @CreateTime:2025-08-16 11:20
 */

//平台端的用户管理
@Tag(name = "UserController",description = "平台端用户管理的接口")
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private IUserService userService;

    /**
    * @Description: 获取所有用户的信息 / 根据条件查询用户信息
    * @Param: [userVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @Operation(summary = "平台端查询用户信息接口")
    @GetMapping("selectByCondition")
    public ResponseDTO selectByCondition(UserVO userVO) {
        return userService.selectByCondition(userVO);
    }

    /**
    * @Description: 重置用户密码
    * @Param: [userVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @MyLog("重置用户密码")
    @Operation(summary = "平台端重置用户密码的接口")
    @PutMapping("resetPassword/{userId}")
    public ResponseDTO resetPassword(@PathVariable("userId") Integer userId) {
        return userService.resetPassword(userId);
    }

    /**
    * @Description: 封禁用户
    * @Param: [userVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @MyLog("封禁用户")
    @Operation(summary = "平台端封禁用户的接口")
    @DeleteMapping("userBlock")
    public ResponseDTO userBlock(UserVO userVO) {
        return userService.userBlock(userVO);
    }

}
